/****************************************************************************
 *
 * Copyright (C) 2003-2008 Los Alamos National Security, LLC
 *                         Packet Analytics Corporation
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License Version 2 as
 * published by the Free Software Foundation.  You may not use, modify or
 * distribute this program under any other version of the GNU General
 * Public License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 ****************************************************************************/
package nfse;

import java.util.*;

/*******************************************************************************
 * This is a data structure for storing metadata about an index stored by
 * NetFSE.
 * 
 * @author This code is the property of Los Alamos National Laboratory and the
 *         University of California, Copyright 2005
 */
public class IndexInfo {

	/***************
	 * Month of the data file (1-12)
	 */
	private int month = -1;

	/***************
	 * Day of month of the data file (1-31)
	 */
	private int day = -1;

	/***************
	 * Year of the data file (YYYY)
	 */
	private int year = -1;

	/***************
	 * Monotonically increasing itteration of files in this day (1-n)
	 */
	private int run = -1;

	/*************
	 * Field of the index from the system metadata
	 */
	private int field = -1;

	/**************************
	 * Full path of the index
	 */
	private String dbPath = "";

	/***************
	 * Full path of the data file that is indexed
	 */
	private String dataPath = "";

	/*********************
	 * Unix time of the earliest record in the data file
	 */
	private long minTime = -1;

	/*********************
	 * Unix time of the latest record in the data file
	 */
	private long maxTime = -1;

	/***************
	 * Sensor that generated the data
	 */
	private int sensorID = -1;

	/***************
	 * For a dynamic index, the node where the index resides
	 */
	private int nodeID = -1;

	public String toString() {
		String temp = "";
		temp += nodeID + " " + sensorID + "/" + field + ": " + month + "-"
				+ day + "-" + year + "." + run + ", " + dbPath + ", "
				+ dataPath;

		GregorianCalendar c1 = new GregorianCalendar();
		c1.setTimeInMillis(getMinTime() * 1000);
		java.util.Date startDate = c1.getTime();
		c1.setTimeInMillis(getMaxTime() * 1000);
		java.util.Date stopDate = c1.getTime();
		temp += " " + startDate.toString() + "-" + stopDate.toString();
		temp += " static ";
		return temp;
	}

	/**
	 * @param month
	 *            the month to set
	 */
	public void setMonth(int month) {
		this.month = month;
	}

	/**
	 * @return the month
	 */
	public int getMonth() {
		return month;
	}

	/**
	 * @param day
	 *            the day to set
	 */
	public void setDay(int day) {
		this.day = day;
	}

	/**
	 * @return the day
	 */
	public int getDay() {
		return day;
	}

	/**
	 * @param year
	 *            the year to set
	 */
	public void setYear(int year) {
		this.year = year;
	}

	/**
	 * @return the year
	 */
	public int getYear() {
		return year;
	}

	/**
	 * @param run
	 *            the run to set
	 */
	public void setRun(int run) {
		this.run = run;
	}

	/**
	 * @return the run
	 */
	public int getRun() {
		return run;
	}

	/**
	 * @param field
	 *            the field to set
	 */
	public void setField(int field) {
		this.field = field;
	}

	/**
	 * @return the field
	 */
	public int getField() {
		return field;
	}

	/**
	 * @param dbPath
	 *            the dbPath to set
	 */
	public void setDbPath(String dbPath) {
		this.dbPath = dbPath;
	}

	/**
	 * @return the dbPath
	 */
	public String getDbPath() {
		return dbPath;
	}

	/**
	 * @param dataPath
	 *            the dataPath to set
	 */
	public void setDataPath(String dataPath) {
		this.dataPath = dataPath;
	}

	/**
	 * @return the dataPath
	 */
	public String getDataPath() {
		return dataPath;
	}

	/**
	 * @param minTime
	 *            the minTime to set
	 */
	public void setMinTime(long minTime) {
		this.minTime = minTime;
	}

	/**
	 * @return the minTime
	 */
	public long getMinTime() {
		return minTime;
	}

	/**
	 * @param maxTime
	 *            the maxTime to set
	 */
	public void setMaxTime(long maxTime) {
		this.maxTime = maxTime;
	}

	/**
	 * @return the maxTime
	 */
	public long getMaxTime() {
		return maxTime;
	}

	/**
	 * @param nodeID
	 *            the nodeID to set
	 */
	public void setNodeId(int nodeID) {
		this.nodeID = nodeID;
	}

	/**
	 * @return the nodeID
	 */
	public int getNodeId() {
		return nodeID;
	}

	/**
	 * @param sensorID
	 *            the sensorID to set
	 */
	public void setSensorId(int sensorID) {
		this.sensorID = sensorID;
	}

	/**
	 * @return the sensorID
	 */
	public int getSensorId() {
		return sensorID;
	}
}